package com.alex.demo.mybatisplus.domain;

import java.util.Date;

import com.baomidou.mybatisplus.annotation.*;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class User {

	@TableId(type = IdType.AUTO)
	private Long id;

	private String name;

	private Integer age;

	private String email;

	@Version // 乐观锁注解
	private Integer version;

	@TableLogic // 逻辑删除
	private Integer deleted;

	// 字段添加填充内容
	@TableField(fill = FieldFill.INSERT)
	private Date createTime;

	@TableField(fill = FieldFill.INSERT_UPDATE)
	private Date updateTime;

	public User(String name, int age, String email) {
		this.name = name;
		this.age = age;
		this.email = email;
	}
}